package com.example.toutiao.ui.main.adpater

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.core.view.isVisible
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.example.toutiao.R
import com.example.toutiao.ui.main.model.RecMainModel
import com.example.toutiao.ui.main.model.RecommenModel

class SearchChildAdapter(model :MutableList<RecommenModel>):RecyclerView.Adapter<SearchChildAdapter.SearchHolder>() {
    private val model:MutableList<RecommenModel>?=model
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SearchHolder =SearchHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_search_hs,parent,false))

    override fun onBindViewHolder(holder: SearchHolder, position: Int) {
        if (model!=null){
            holder.tag.text="${model[position].name}"
        }
    }
    override fun getItemCount(): Int=3
    class SearchHolder(it: View):RecyclerView.ViewHolder(it){
        val tag:TextView=it.findViewById(R.id.tv_content)

    }
}